class User < ActiveRecord::Base
  belongs_to :usable, :polymorphic => true
  
  has_secure_password
  validates_presence_of :password, :on => :create
  validates_presence_of :email, :on => :create
  validates :email, :uniqueness => { :case_sensitive => false }
  
  def student?
    usable_type == 'Student'
  end
  
  def instructor?
    usable_type == 'Instructor'
  end
end
